package jsyf.oa.web.report;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import jsyf.com.util.BaseUtils;
import jsyf.com.util.ResponseUtils;
import jsyf.oa.facade.report.ExhibitionReportFacade;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Created by Administrator on 2018/3/7 0007.
 */
@Api(value = "报表接口", description = "报表接口")
@Controller
@RequestMapping("/exhibition")
public class ExhibitionReportController {

    @Resource
    private ExhibitionReportFacade exhibitionReportFacade;

    @RequestMapping(value = "/getExhibitionByCard.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "展会卡片",
            notes = "展会卡片",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "", dataType = "String", paramType = "body")
    })
    public void getExhibitionByCard(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        JSONObject records = this.exhibitionReportFacade.getExhibitionByCard(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessObjRespond(records));
    }

    @RequestMapping(value = "/getExhibitionByCompany.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "展会公司报表",
            notes = "展会公司报表",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "", dataType = "String", paramType = "body")
    })
    public void getExhibitionByCompany(HttpServletRequest request, HttpServletResponse response) {
        List<JSONObject> records = this.exhibitionReportFacade.getExhibitionByCompany();
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @RequestMapping(value = "/getExhibitionList.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "展会列表",
            notes = "展会列表",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "", dataType = "String", paramType = "body")
    })
    public void getExhibitionList(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records= this.exhibitionReportFacade.getExhibitionList(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }
    @RequestMapping(value = "/getExhibitionByRegion.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "大区展会列表",
            notes = "大区展会列表",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "", dataType = "String", paramType = "body")
    })
    public void getExhibitionByRegion(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records= this.exhibitionReportFacade.getExhibitionByRegion(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }

    @RequestMapping(value = "/getExhibitionCustomer.json", method = RequestMethod.POST)
    @ApiOperation(
            value = "客户展会列表",
            notes = "客户展会列表",
            httpMethod = "POST",
            response = ResponseUtils.class,
            produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jsonData", value = "", dataType = "String", paramType = "body")
    })
    public void getExhibitionCustomer(HttpServletRequest request, HttpServletResponse response, @RequestBody String jsonData) {
        List<JSONObject> records= this.exhibitionReportFacade.getExhibitionCustomer(jsonData);
        ResponseUtils.putJsonResponse(response, BaseUtils.succsessArrRespond(records));
    }
}
